<?php
class My_Db_DisplayTree extends Zend_Db_Table_Rowset_Abstract {
	//	protected $_childId = 'id';
	//	protected $tree_name = $this->_table;
	//	protected public 
	

	function a() {
		$cache = Zend_Registry::get ( "cache" );
		$this->tree = new My_DisplayTree ( );
		
		if (! $Tree = $cache->load ( $this->_tableClass )) {
			$Tree = $this->_data;
			$cache->save ( $Tree, $this->_tableClass );
		} else {
			$Tree = $cache->load ( $this->_tableClass );
		}
		$Tree = $this->_data;
		return $Tree;
	
	}
	public function getChilds($withTop = false) {
		//		$tree_name = $this->_tableClass;
		$Tree = $this->a ();
		
		for($i = 0; $i < count ( $Tree ); $i ++) {
			$this->tree->setNode ( $Tree [$i] ['id'], $Tree [$i] ['parent_id'], $Tree [$i] ['name'] );
		}
		
		if ($withTop) {
			$b [0] .= "";
		}
		foreach ( $this->tree->getChilds () as $key => $id ) {
			
			if ($id != 0) {
				$b [$id] = '|-';
			}
			
			if ($id != 0) {
				$b [$id] .= $this->tree->getLayer ( $id, '|-' ) . $this->tree->getValue ( $id );
			}
		}
		
		return $b;
	}
}

?>